/*
	Copyright (c) 2007, ANYwebcam.com Pty Ltd. All rights reserved.

	The software in this package is published under the terms of the BSD style 
	license, a copy of which has been included with this distribution in the 
	license.txt file.
*/
package com.anywebcam.di.component
{
	import com.anywebcam.di.*;

	/**
	 * Decorates a child component  allowing subclasses to modify the 
	 * parameters and return objects of the DIComponent methods 
	 */
	public class DecoratingComponent extends AbstractComponent implements DIComponent
	{
		private var _delegate:DIComponent;
		
		/**
		 * Constructor
		 * 
		 * @param delegate The DIComponent to decorate
		 */
		public function DecoratingComponent( delegate:DIComponent )
		{
			_delegate = delegate;
			
			super( key, type );
		}
		
		/**
		 * @inheritDoc
		 */
		override public function get key():Object
		{
			return _delegate.key;
		}
		
		/**
		 * @inheritDoc
		 */
		override public function get type():Class
		{
			return _delegate.type;
		}
		
		/**
		 * @inheritDoc
		 */
		override public function getInstance( container:DIContainer ):Object
		{
			return _delegate.getInstance( container );
		}
	}
}